import java.util.ArrayList;
import java.util.Scanner;

public class add {
    public static void add_student(ArrayList<Student> studentlist) {
        Scanner sc = new Scanner(System.in);
        Student newstudent = new Student();
        System.out.println("请输入要添加的学生学号：");
        String id = sc.nextLine();
        boolean sicunzai = is_exist.is_exist_id(studentlist, id);
        if (sicunzai) {
            System.out.println("添加失败，该学号已被占用");
            return;
        }
        System.out.println("请输入要添加的学生姓名：");
        String name = sc.nextLine();
        System.out.println("请输入要添加的学生年龄：");
        String age = sc.nextLine();
        newstudent.setSid(id);
        newstudent.setName(name);
        newstudent.setAge(Integer.valueOf(age));
        studentlist.add(newstudent);

        select.select_all(studentlist);
    }
}
